<tagLib name="html"/>
<include file="./Index/Tpl/Home/default/public/header.htm" />
<link href="__PUBLIC__/css/inn-adm-base.css" type="text/css" rel="stylesheet" />
<style type="text/css">
.sjht_xx{
	padding-top:0px;
	margin:0;
	font-size:12px;
	color:#000;
	line-height:15px;
}
.sjht_fd table{
	border-top:2px solid #35AFC1;
	border-left:1px solid #e0e0e0;
	text-align:center;
}
.sjht_fd table td{
	border-right:1px solid #e0e0e0;
	border-bottom:1px solid #e0e0e0;
	padding:5px;
}
.sjht_fd table .title{
	height:33px;
	background:url(__PUBLIC__/images/tr_bg.png);
}
.sjht_fd table .title td{
	padding:0px;
}
.sjht_fd a{
	color:#0069CA;
}
</style>
<script src="http://cdn.jquerytools.org/1.2.7/form/jquery.tools.min.js"></script>
<script type="text/javascript">
(function($){
    $(function(){
        $("#myform").validator({
            messageClass:"yellow",
            position:"bottom left"
        });
        $("#myform input").focus(function(){
            $(this).addClass('input_hover');
        }).blur(function(){
            $(this).removeClass('input_hover');
        });
    });
})(jQuery);
</script>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/jsLibrary/uploadify/uploadify.css" />
<script src="__PUBLIC__/jsLibrary/uploadify/jquery.uploadify-3.1.min.js"></script>
<script type='text/javascript'>
function del(id) {
    if(confirm('确定要删除此图片？')) {
        $.post('__KZURL__/room/delimages', { "id": <{$room["id"]}>, "imgid":id, "innid":"<{$inn.id}>" },
            function(data){
                if(data!=1)
                    alert(data);
                else
                    $('#innimages'+id).remove();
            }, "text");
    }
}
$(function() {
    $("#images_upload").uploadify({
        swf      : '__PUBLIC__/jsLibrary/uploadify/uploadify.swf',
        uploader : '__KZURL__/room/upimages',
        height   : 30,
        width    : 120,
        buttonText: '选择图片',
        fileTypeExts: '*.gif;*.jpg;*.jpeg;*.png',
        fileSizeLimit: '1024KB',
        formData: {
            "id":"<{$room.id}>",
            "innid":"<{$inn.id}>"
        },
        onUploadSuccess: function (file, data, response) {
            if (data.indexOf('错误提示：') > -1) {
                alert(data);
            } else {
                data    = eval('(' + data + ')');
                domStr  = "<span id='innimages"+data.picid+"'>";
                domStr += "  <em class='del'>";
                domStr += "    <a href='javascript:;'>";
                domStr += "      <img src='__PUBLIC__/images/sc.png' onclick='del("+data.picid+")' />";
                domStr += "    </a>";
                domStr += "  </em>";
                domStr += "  <em>";
                domStr += "    <img src='"+data.picpath+"' width='100' />";
                domStr += "  </em>";
                domStr += "</span>";
                $("li.tpj").append(domStr);
            }
        },
        onUploadError: function (file, errorCode, errorMsg, errorString) {
            alert('文件：' + file.name + ' 上传失败: ' + errorString);
        }
    });
});
</script>
<div class="content">
  <include file="public:innleft" />
  <!--商家后台右边 start-->
  <div class="sjht_right"><div class="sjht_xx"><div class="sjht_fd">
        <ul>
            <li class="jt_title">
                <a href='__KZURL__/room/index-innId-<{$inn.id}>'>[房型管理]</a>
                <a href='__KZURL__/price/index-innId-<{$inn.id}>'>[价格管理]</a>
            </li>
        </ul>
        <div style='float:left;width:49%'>
            <h2 style='line-height:40px;'><{$inn.name}></h2>
            <ul>
                <volist name='roomList' id='vo'>
                <li><a href="__KZURL__/room/index-innId-<{$inn.id}>-roomid-<{$vo.id}>"><{$vo.name}></a></li>
                </volist>
                <input class="jx" type="button" onclick='window.location.href="__KZURL__/room/index-innid-<{$inn.id}>"' value="添加房型" />
            </ul>
        </div>
        <div style='float:left;width:49%'>
            <h2 style='line-height:40px;'><empty name='room'>添加房型<else/>修改房型</empty></h2>
            <form id="myform" method='post' action='__KZURL__/room/do_room'>
                <ul>
                    <li class="sjht_jtxx">
                        <p class="zc_xx">
                            <span class="zc_xx_title">房型名称</span>
                            <span><input type="text" name='name' value='<{$room.name}>' required="required" data-message="请填写房型名称！" /></span>
                        </p>
                    </li>
                    <li class="sjht_jtxx">
                        <p class="zc_xx">
                            <span class="zc_xx_title">所属酒店</span>
                            <span class="dx"><{$inn.name}></span>
                        </p>
                    </li>
                    <li class="sjht_jtxx">
                        <p class="zc_xx">
                            <span class="zc_xx_title">房型类别</span>
                            <span><html:select name='type' options='roomTypeList' selected="room['type']" /></span>
                        </p>
                    </li>
                    <li class="sjht_jtxx">
                        <p class="zc_xx">
                            <span class="zc_xx_title">预定类型</span>
                            <span><html:select name='orderType' options='roomOrderTypeList' selected="room['orderType']" /></span>
                        </p>
                    </li>
                    <li class="sjht_jtxx">
                        <p class="zc_xx">
                            <span class="zc_xx_title">床位数</span>
                            <span><input type="text" name='bed' value='<{$room.bed}>' required="required" data-message="请填写床位数！" /></span>
                        </p>
                    </li>
                    <li class="sjht_jtxx">
                        <p class="zc_xx">
                            <span class="zc_xx_title">每晚可预定房间数</span>
                            <span><input type="text" name='num' value='<{$room.num}>' required="required" data-message="请填写可预定房间数！" /></span>
                        </p>
                    </li>
                    <li class="sjht_jtxx">
                        <p class="zc_xx">
                            <span class="zc_xx_title">房型简介</span>
                            <span><html:editor id="des" name="des"><{$room.des}></html:editor></span>
                        </p>
                    </li>
                    <empty name='room'>
                    <li class="sjht_jtxx">添加房型成功后可以继续设置房型照片</li>
                    <else/>
                    <li class="sjht_jtxx">
                        <p class="zc_xx">
                            <span class="zc_xx_title">房型图片</span>
                            <span><input type="file" name='images_upload' id='images_upload' /></span>
                        </p>
                    </li>
                    <li class="tpj">
                        <volist name='InnRoomImagesList' id='vo'>
                        <span id='innimages<{$vo.id}>'>
                            <em class="del"><a href='javascript:;'><img src="__PUBLIC__/images/sc.png" onclick='del(<{$vo.id}>)' /></a></em>
                            <em><img src="<{$vo.path}>" width="100" /></em>
                        </span>
                        </volist>
                    </li>
                    </empty>
                    <li class="sjht_jtxx">
                        <p class="zc_xx">
                            <span class="zc_xx_title">排序</span>
                            <span><input type="text" name='display_order' value='<{$room.display_order}>' /></span>
                        </p>
                    </li>
                </ul>
                <ul class="kt_next_two">
                     <li>
                        <input type="hidden" value='<{$inn.id}>' name='innId'>
                        <empty name='room'>
                        <input class="jx" type="submit" name='add' value="添加房型" />
                        <else/>
                        <input type="hidden" value='<{$room.id}>' name='id'>
                        <input class="jx" type="button" onclick='if(confirm("将删除此房型的所有数据，确定删除吗？"))window.location.href="__KZURL__/room/do_delete-innid-<{$inn.id}>-roomid-<{$room.id}>"' value="删除此房型" />
                        <input class="jx" type="submit" name='modify' value="保存房型修改" />
                        </empty>
                     </li>
                </ul>
            </form>
        </div>
    </div></div></div>
    <!--
    <table width="49%" style='float:left;' cellspacing="0" cellpadding="0">
      <caption><h2 style='line-height:40px;'><{$inn.name}></h2></caption>
      <tr class="title">
        <td>房型名称</td>
        <td width=''>房型类别</td>
        <td width=''>房间数量</td>
        <td width=''>排序</td>
        <td width=''>操作</td>
      </tr>
      <volist name='roomList' id='vo'>
      <tr>
        <td><a href="__KZURL__/room/modify-id-<{$vo.id}>"><{$vo.name}></a></td>
        <td>&nbsp;<{$vo.typeName}>&nbsp;</td>
        <td><{$vo.num}></td>
        <td><{$vo.display_order}></td>
        <td>
            <a href="__KZURL__/room/do_delete-id-<{$vo.id}>" onclick='return confirm("将删除此房型所有信息，且无法恢复，请确认是否需要删除？")'>删除房型信息</a>
            <a href="__KZURL__/room/modify-id-<{$vo.id}>">修改房型信息</a>
            <a href="__KZURL__/DateSet/dayprice-innid-<{$inn.id}>-roomid-<{$vo.id}>">管理房型价格</a>
        </td>
      </tr>
      </volist>
      <tr>
        <td colspan='5' align='right'>
            <input class="jx" type="button" onclick='window.location.href="__KZURL__/room/add-id-<{$inn.id}>"' value="添加房型信息" />
        </td>
      </tr>
    </table>
    
    
    <table width="49%" style='float:left;' cellspacing="0" cellpadding="0">
      <tr>
        <td colspan='5' align='right'>
            <input class="jx" type="button" onclick='window.location.href="__KZURL__/room/add-id-<{$inn.id}>"' value="添加房型信息" />
            <input class="jx" type="button" onclick='window.location.href="__KZURL__/DateSet/index-innid-<{$inn.id}>"' value="批量设置价格" />
        </td>
      </tr>
    </table>
    -->
</div>
<include file='./Index/Tpl/Home/default/public/footer.htm' />